import {request} from './request';

//添加购物车
export function addCart(data) {
    return request({
        url:'/api/carts',
        method:'post',
        data
    })
}

//change购物车num data = {num:1}
export function modifyCart(id,data) {
    return request({
        url:`/api/carts/${id}`,
        method:'put',
        data
    })
}

//选中购物车状态 
export function checkedCart(data) {
    return request({
        url:'/api/carts/checked',
        method:'patch',
        data
    })
}

//购物车列表
export function getCart(data='') {
    return request({
        url:'/api/carts?'+data,
        method:'get',
    })
}

//删除购物车
export function delCart(id) {
    return request({
        url:`/api/carts/${id}`,
        method:'delete',
    })
}